package club.caihappy.config;

import club.caihappy.dao.BookDao;
import club.caihappy.pojo.Car;
import club.caihappy.pojo.Color;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * Created by DELL on 2021/10/7
 **/
@ComponentScan({"club.caihappy.controller", "club.caihappy.dao", "club.caihappy.service","club.caihappy.pojo"})
@Configuration
public class MainConfigOfAutowired {

    @Primary
    @Bean("bookDao2")
    public BookDao bookDao() {
        BookDao bookDao = new BookDao();
        bookDao.setLabel("2");
        return bookDao;
    }
    @Bean
    public Color color(Car car){
        Color color=new Color();
        color.setCar(car);
        return color;
    }
}
